package com.wxyzz.canteencommon.config;

import com.wxyzz.canteencommon.common.LoginInterception;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * --- 加油，努力 ---
 *
 * @Author XYP
 * @Date 2024/10/14
 * @Solgne 从想做到能做
 * @Desc
 */
@Configuration
public class MyWebMvcInterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterception loginInterception;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterception)
                .addPathPatterns("/**")
                .excludePathPatterns("/sys/user/login")
                .excludePathPatterns("/shop/desk/upload")
                .excludePathPatterns("/captcha")
                .excludePathPatterns("/shop/employee/download/excel")
                .excludePathPatterns("/shop/employee/upload/excel")
                .excludePathPatterns("/upload/**");
    }
}
